//
//  NSUserDefaults+HACShield.m
//  HACRouter
//
//  Created by Chengjie on 2019/5/22.
//

#import "NSUserDefaults+HACShield.h"
#import "NSObject+HACSwizzling.h"

@implementation NSUserDefaults (HACShield)

+ (void)load {
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        hac_swizzleInstanceMethod(hac_getClass(@"NSU", @"serDefaults"), @selector(setObject:forKey:), @selector(hac_setObject:forKey:));
    });
}

- (void)hac_setObject:(id)anObject forKey:(NSString *)aKey {
    if (aKey && anObject && [aKey isKindOfClass:[NSString class]]){
        [self hac_setObject:anObject forKey:aKey];
    }
}

@end
